package com.example.x6.gpio_3288demo;

import android.util.Log;

import static android.content.ContentValues.TAG;

public class LightUtils {
    private static int  numgroup = 3;
    private static char group = 'D';
    private static int num = 3;

    private final static String   TAG = "gpioctl";
    private static GpioUtils gpioUtils;
    private static int io = 0;
    private static boolean is_in = false;
    private static boolean is_low = false;
    private static int high = 1;
    private static int low = 0;
    public static void OpenLight(){
        try{
            //setContentView(R.layout.activity_open);
            gpioUtils = GpioUtils.getGpioUtils();
            io = gpioUtils.getGpioPin(numgroup,group,num);
            Log.e(TAG,String.valueOf(io));
            gpioUtils.setGpioDirection(io,0);
            gpioUtils.gpioSetValue(io,high);
            if(gpioUtils != null)
                gpioUtils.close();
        }catch(Exception e){

        }
    }
    public static void CloseLight(){
        try{
            //setContentView(R.layout.activity_open);
            gpioUtils = GpioUtils.getGpioUtils();
            io = gpioUtils.getGpioPin(numgroup,group,num);
            Log.e(TAG,String.valueOf(io));
            gpioUtils.setGpioDirection(io,0);
            gpioUtils.gpioSetValue(io,low);
            if(gpioUtils != null)
                gpioUtils.close();
        }catch(Exception e){

        }
    }
}
